package com.tenpines.test.helper;

import org.hamcrest.Description;

/**
 * Represents a condition which will be evaluated asynchronously.
 * 
 * @author egutter
 * 
 */
public interface AsyncCondition {

	/**
	 * Returns <b>true</b> if the condition was satisfied and the test can be
	 * considered successful.<br />
	 * Returns <b>false</b> if the condition hasn't been satisfied yet and the
	 * test should keep polling the system our failed if the timeout is reached.
	 * 
	 * @return
	 */
	public boolean isSatisfied();

	/**
	 * Samples the SUT in order to evaluate if the expected condition has been
	 * satisfied.
	 * 
	 */
	public void sample();

	/**
	 * Describes the failure if the condition hasn't been satisfied.
	 * 
	 * @param d
	 */
	public void describeFailureTo(Description d);

}
